package com.sampleapp.dynamitechetan.sample;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;

import ohos.agp.components.Component;

public class MainAbility extends Ability {

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_main1);
        findComponentById(ResourceTable.Id_go_to_next).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent secondIntent = new Intent();
                Operation operation = new Intent.OperationBuilder()
                        .withBundleName(getBundleName())
                        .withAbilityName(SecondAbility.class.getName())
                        .build();
                secondIntent.setOperation(operation);
                startAbility(secondIntent);
            }
        });
    }

}
